package com.szeldon.pj.jps.datastore;

import java.math.BigInteger;

/**
 * Identifier for SBAOBjects. Comparable, hashable. Currently works on BigInteger objects.
 * 
 */
public final class SBAObjectId {

	private BigInteger bigInteger;

	public SBAObjectId(BigInteger bigInteger) {
		this.bigInteger = bigInteger;
	}

	@Override
	public int hashCode() {
		return toString().hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		if (obj.getClass().equals(this.getClass())) {
			SBAObjectId objSBA = (SBAObjectId) obj;
			return toString().equals(objSBA.toString());
		} else {
			return false;
		}
	}

	public int compareTo(SBAObjectId sbaObjectId) {

		SBAObjectId objSBA = (SBAObjectId) sbaObjectId;
		return toString().compareTo(objSBA.toString());

	}

	@Override
	public String toString() {
		return bigInteger.toString();
	}

}
